import Vue from 'vue'
import Router from 'vue-router'
import Recommend from './views/Recommend.vue'
import Category from './views/Category.vue'
import BookInfo from './views/BookInfo'
import Reader from './views/Reader'
import Search from './views/Search'
import BookCase from './views/BookCase'
import Mine from './views/Mine'
import Login from './views/Login'
import Regist from './views/Regist'




Vue.use(Router)

export default new Router({
    // 如果使用history模式，node后端代码需要修改配合，否则刷新页面时会出问题；
    // 如果使用默认的hash模式，node后端直接使用static插件就行了，不会出现任何问题，只是路径中会出现#号
    // mode: 'history',
    base: process.env.BASE_URL,
    routes: [{
            path: '/',
            redirect: '/recommend'
        },
        {
            path: '/recommend',
            name: 'recommend',
            component: Recommend
        },
        {
            path: '/bookcase',
            name: 'bookcase',
            component: BookCase
        },
        {
            path: '/category',
            name: 'category',
            component: Category
        },
        {
            path: '/bookinfo/:bookUrl',
            name: 'bookinfo',
            component: BookInfo,
            // meta:{
            //     keepAlive:true
            // }

        },
        {
            path: '/reader',
            name: 'reader',
            component: Reader
        },
        {
            path: '/search',
            name: 'search',
            component: Search
        },
        {
            path: '/mine',
            name: 'mine',
            component: Mine
        },
        {
            path: '/login',
            name: 'login',
            component: Login
        },
        {
            path: '/regist',
            name: 'regist',
            component: Regist
        }
    ]
})